package org.zfes.snowier.zbss.xzy.router.vedio;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.vedio.model.DeviceVedioDir;
import org.zfes.snowier.zbss.xzy.biz.vedio.service.IDeviceVedioDirService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/vediodir")
public class DeviceVedioDirController implements BaseController {

	
	@Autowired
	private IDeviceVedioDirService deviceVedioDirService;
	
	//@RequiresPermissions(value="deviceVedioDir:loadDeviceVedioDirDataSet",desc="视频目录列表")
    @RequestMapping(value="/loadDeviceVedioDirDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadDeviceVedioDirDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  deviceVedioDirService.loadDeviceVedioDirDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="deviceVedioDir:createDeviceVedioDir",desc="视频目录添加")
    @RequestMapping(value="/createDeviceVedioDir", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createDeviceVedioDir(@RequestBody DeviceVedioDir deviceVedioDir){
		deviceVedioDirService.createDeviceVedioDir(deviceVedioDir);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="deviceVedioDir:loadDeviceVedioDir",desc="视频目录加载")
    @RequestMapping(value="/loadDeviceVedioDir/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadDeviceVedioDir(@PathVariable("id")Long id){
		Optional<DeviceVedioDir> ops = deviceVedioDirService.loadDeviceVedioDirById(id);
		return ajaxQuery("deviceVedioDir",ops);
    }
	
	//@RequiresPermissions(value="deviceVedioDir:updateDeviceVedioDir",desc="视频目录更新")
    @RequestMapping(value="/updateDeviceVedioDir", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateDeviceVedioDir(@RequestBody  DeviceVedioDir deviceVedioDir){
		deviceVedioDirService.updateDeviceVedioDir(deviceVedioDir);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="deviceVedioDir:deletDeviceVedioDir",desc="视频目录删除")
    @RequestMapping(value="/deleteDeviceVedioDir/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteDeviceVedioDir(@PathVariable("id")Long id){
		deviceVedioDirService.deleteDeviceVedioDir(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadDeviceVedioDirSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadDeviceVedioDirSelectVo(){
		 List<SelectVo>  ops = deviceVedioDirService.loadDeviceVedioDirSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}